package com.example.asapp.demo.curd;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@Slf4j
@RequestMapping("/api/demo/curd")
public class CurdApi {

    @Autowired
    CurdService curdService;

    @GetMapping("listQuery")
    public List<CurdVO> listQuery(CurdQuery curdQuery){
        return curdService.listQuery(curdQuery);
    }

    @PostMapping("add")
    public int addCurd(@RequestBody CurdVO curdVO){
        return curdService.add(curdVO);
    }

    @PutMapping("edit")
    public int editCurd(@RequestBody CurdVO curdVO){
        return curdService.edit(curdVO);
    }

    @DeleteMapping("delete/{id}")
    public int deleteCurd(@PathVariable String id){

        return curdService.delete(id);
    }


}
